package com.lagou.boot;

import com.lagou.client.RPCConsumer;
import com.lagou.service.IUserService;
import com.lagou.util.ZkUtils;

import java.io.IOException;

/**
 * Created by seemygo on 2021/1/14.
 */
public class ConsumerBoot {

    //1,参数定义
    //private static final String PROVIDER_NAME="UserService#sayHello#";

    //2,启动
    public static void main(String[] args) throws Exception {

        //加载zk服务节点信息并存储
        ZkUtils.loadZkProvider();

        //1,创建代理对象
        IUserService userService=(IUserService) RPCConsumer.createProxy(IUserService.class);

        //2,循环给服务器写数据
        while (true){
            String result=userService.sayHello("are you ok !!");
            System.out.println(result);
            Thread.sleep(2000);
            System.out.println("已响应");
        }
    }

}
